package com.example.jdk21;

public class RecordTest {
    public static void main(String[] args) {

    }

    record Point(int x, int y) {}

    record Size(int width, int height) { }
    record WindowFrame(Point origin, Size size) { }


    static void printSum(Object obj) {
        if (obj instanceof Point p) {
            int x = p.x();
            int y = p.y();
            System.out.println(x+y);
        }
    }

    static void printSum2(Object obj) {
        if (obj instanceof Point(int x, int y)) {
            System.out.println(x+y);
        }
    }


}
